<?php
/**
 * JoiGallery - image gallery component for Joostina
 *
 * Менеджер дополнительных полей
 *
 * @version 1.0 alpha 3
 * @package JoiGallery
 * @subpackage	AdminView
 * @filename extrafields_list.php
 * @author JoostinaTeam
 * @copyright (C) 2008-2009 Joostina Team
 * @license see license.txt
 *
 **/
 
defined('_VALID_MOS') or die();

?>

		<table class="adminheading">
			<tr><th class="config">JoiGallery - Дополнительные поля</th></tr>
		</table>

		<form action="index2.php" method="post" name="adminForm" id="adminForm">

			<table class="adminlist" width="100%">
				<tr>
					<th width="30">ID</th>
					<th width="20">
                        <input type="checkbox" name="toggle" value="" onClick="checkAll(<?php echo count( $extrafields_list );?>);" />
                    </th>
					<th>Поле</th>	
                    <th>Тип</th>
                    <th>Подпись</th>
                    <th>Обязательное</th>
                    <th>Опубликовано</th>
				</tr>
				
				<?php 
				$i = 0; 
				foreach($extrafields_list as $field){
			            $link = 'index2.php?option='.$option.'&act=extrafields&task=extrafield&cid='.$field->id;
			            $field_name = '<a href="'.$link.'">'.$field->name.'</a>';				    
    					$img = $field->published ? 'publish_g.png' : 'publish_x.png';
    					?>
    				<tr>
    					<td><?php echo $field->id; ?></td>
    					<td align="center"><?php echo mosHTML::idBox($i, $field->id); ?></td>
    					<td><?php echo $field_name; ?></td>
                        <td> <?php echo $field->type; ?> </td>
                        <td> <?php echo $field->label; ?> </td>
                        <td><?php echo ($field->required ? 'Да' : 'Нет'); ?></td>
                        
                        <td>
                        <a href="javascript:void(0);" onclick="return listItemTask('cb<?php echo $i;?>','<?php echo $field->published ? 'unpublish' : 'publish'; ?>')">
				            <img src="images/<?php echo $field->published ? "tick.png" : "publish_x.png"; ?>" border="0" />
				        </a>
				        </td>
                                               
    				</tr>						
                <? $i++; } ?>
				
			</table>

			<input type="hidden" name="option" value="<?php echo $option; ?>" />
			<input type="hidden" name="act" value="extrafields" />
			<input type="hidden" name="task" value="" />
			<input type="hidden" name="<?php echo josSpoofValue(); ?>" value="1" />
			<input type="hidden" name="boxchecked" value="0" />
		</form>